<template>
	<view class="shopcart">
		<view class="shopcart-banner">
			<image class="banner-img"
				src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/shopcartbg.png"></image>
			<image class="banner-img1"
				src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zuanshi.png"></image>
			<view class="shopcart-navbar">
				<image class="shopcart-navbar-img"
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/back.png"
					@click="back"></image>
				<view class="title">
					{{$t('shopcarts.购卡中心')}}
				</view>
			</view>
			<!-- <u-navbar class="navbar" :is-fixed="true" :title="$t('shopcarts.购卡中心')" back-icon-name="arrow-leftward"
				:background="background" :title-color="titlecolor" :back-icon-color="titlecolor">
				<view class="slot-wrap greenbg">
					<view class="u-navbar-centent-slot">
					</view>
				</view>
			</u-navbar> -->
			<view class="shopcart-class">
				<view class="">
					<text>{{$t('shopcarts.普通卡有效期')}}</text>
					<text class="red">{{$t('shopcarts.6')}}</text>
					<text>{{$t('shopcarts.个月')}}</text>
				</view>
				<view class="">
					<text>{{$t('shopcarts.超级卡有效期')}}</text>
					<text class="red">{{$t('shopcarts.12')}}</text>
					<text>{{$t('shopcarts.个月')}}</text>
				</view>
			</view>

		</view>


		<view class="zhongjia">
			<image class="zhongjiaimg" src="../../static/images/Subtract.png" @click="back"></image>
		</view>

		<view class="shopcart-box">
			<view class="shopcart-tabs">
				<u-tabs-swiper activeColor="#F5C781 " ref="tabs" :list="list" :current="current" @change="change"
					:is-scroll="true" swiperWidth="750"></u-tabs-swiper>
			</view>
			<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
				<swiper-item class="swiper-item">
					<view class="cartview">
						<view class="cartviewr" :class="{boxbg:talda==index}" v-for="(row, index) in cartjson.normal"
							:key="index" @click="taldaw(index)">
							<view class="cartviewrowtxt bluetext font-45">
								<text>{{row.tshuliang}}{{$t('shopcarts.卡')}}</text>
							</view>
							<view class="cartviewrowprice">
								<text>{{(row.tjiage/row.tshuliang)}}{{$t('shopcarts.元')}}/1{{$t('shopcarts.卡')}}</text>
							</view>
							<view class="song" v-if="row.zengsong != 0"><text>{{$t('shopcarts.送')}}</text></view>
						</view>
					</view>

					<view class="activity">
						<view class="activitys activityone">
							<view class="activitys-top">
								<!-- {{$t('shopcarts.购卡满100张')}} -->
								{{cartshoptxt.cuxiao_putong_2_biaoti}}
							</view>
							<view class="activitys-bottom">
								<image class="activitys-zeng-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zeng.png">
								</image>
								<view class="activity-ka">
									{{cartshoptxt.cuxiao_putong_2_cartnum}}卡
								</view>
								<view class="activity-jia">
									价值{{cartshoptxt.cuxiao_putong_2_cartprice}}
								</view>
							</view>
						</view>
						<view class="activitys activitytwo">
							<view class="activitys-top">
								<!-- {{$t('shopcarts.购卡满200张')}} -->
								{{cartshoptxt.cuxiao_putong_3_biaoti}}
							</view>
							<view class="activitys-bottom">
								<image class="activitys-zeng-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zeng.png">
								</image>
								<view class="activity-ka">
								{{cartshoptxt.cuxiao_putong_3_cartnum}}卡
								</view>
								<view class="activity-jia">
									价值{{cartshoptxt.cuxiao_putong_3_cartprice}}
								</view>
							</view>
						</view>
					</view>

					<view class="introduce">
						<view class="introduce-text">
							<image class="introduce-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/kaicon.png">
							</image>
							<view class="">
								{{totalmoney}}元/{{normalkanum}}张卡
							</view>
						</view>
						<view class="introduce-zs">
							赠送{{normalsong}}张卡
						</view>
					</view>
					<!-- 支付方式 -->
					<view class="payfor">
						<view class="payfor-text">
						选择支付方式
						</view>
						<view class="payfor-class">
							<view class="payfor-class-item" :class="{payfored:paytype=='wxpay'}"
								@click="radioChange('wxpay')">
								<image class="payfor-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/wx.png">
								</image>
								<view class="payfor-class-text">
									{{$t('shopcarts.微信支付')}}
								</view>
							</view>
							<view v-if="terminalos == 'app'" class="payfor-class-item"
								:class="{payfored:paytype=='alipay'}" @click="radioChange('alipay')">
								<image class="payfor-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zfb.png">
								</image>
								<view class="payfor-class-text">
									{{$t('shopcarts.支付宝支付')}}
								</view>
							</view>
						</view>
					</view>

					<view class="okpayfor">
						<view class="okpayfor-sub" @click="orderpay(1)">
							<image class="payfor-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/payforsub.png">
							</image>
							<view class="okpayfor-text">
								{{$t('shopcarts.确认并支付')}}{{totalmoney}}
							</view>
						</view>
					</view>
					<view class="shopcart-xy">
						<image class="xy-img"
							src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/xyicon.png">
						</image>
						<view class="xy-befor">
							{{$t('shopcarts.开通前请阅读')}}
						</view>
						<view class="xy-vip">
							{{$t('shopcarts.会员协议')}}
						</view>

					</view>


				</swiper-item>
				
				<!-- 超级卡 -->
				<swiper-item class="swiper-item">
					<view class="cartview">
						<view class="cartviewr" :class="{boxbg:stalda==index}" v-for="(row, index) in cartjson.super"
							:key="index" @click="staldaw(index)">
							<view class="cartviewrowtxt bluetext font-45">
								<text>{{row.tshuliang}}{{$t('shopcarts.卡')}}</text>
							</view>
							<view class="cartviewrowprice">
								<text>{{(row.tjiage/row.tshuliang)}}{{$t('shopcarts.元')}}/1{{$t('shopcarts.卡')}}</text>
							</view>
							<view class="song" v-if="row.zengsong != 0"><text>{{$t('shopcarts.送')}}</text></view>
						</view>
					</view>

					<view class="activity">
						<view class="activitys activityone">
							<view class="activitys-top">
								<!-- {{$t('shopcarts.购卡满100张')}} -->
								{{cartshoptxt.cuxiao_gaoji_2_biaoti}}
							</view>
							<view class="activitys-bottom">
								<image class="activitys-zeng-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zeng.png">
								</image>
								<view class="activity-ka">
									<!-- {{$t('shopcarts.25')}}{{$t('shopcarts.张卡')}} -->
									{{cartshoptxt.cuxiao_gaoji_2_cartnum}}卡
								</view>
								<view class="activity-jia">
									价值{{cartshoptxt.cuxiao_gaoji_2_cartprice}}
								</view>
							</view>
						</view>
						<view class="activitys activitytwo">
							<view class="activitys-top">
								<!-- {{$t('shopcarts.购卡满200张')}} -->
								{{cartshoptxt.cuxiao_gaoji_3_biaoti}}
							</view>
							<view class="activitys-bottom">
								<image class="activitys-zeng-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zeng.png">
								</image>
								<view class="activity-ka">
									<!-- {{$t('shopcarts.60')}}{{$t('shopcarts.张卡')}} -->
									{{cartshoptxt.cuxiao_gaoji_3_cartnum}}卡
								</view>
								<view class="activity-jia">
									价值{{cartshoptxt.cuxiao_gaoji_3_cartprice}}
								</view>
							</view>
						</view>
					</view>

					<view class="introduce">
						<view class="introduce-text">
							<image class="introduce-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/kaicon.png">
							</image>
							<view class="">
							{{stotalmoney}}元/{{skanum}}张卡
							</view>
						</view>
						<view class="introduce-zs">
							赠送{{ssong}}张卡
						</view>
					</view>
					<!-- 支付方式 -->
					<view class="payfor">
						<view class="payfor-text">
							支付方式
						</view>
						<view class="payfor-class">

							<view class="payfor-class-item" :class="{payfored:paytype=='wxpay'}"
								@click="radioChange('wxpay')">
								<image class="payfor-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/wx.png">
								</image>
								<view class="payfor-class-text">
								微信支付
								</view>
							</view>
							<view v-if="terminalos == 'app'" class="payfor-class-item"
								:class="{payfored:paytype=='alipay'}" @click="radioChange('alipay')">
								<image class="payfor-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zfb.png">
								</image>
								<view class="payfor-class-text">
									支付宝支付
								</view>
							</view>
						</view>
					</view>

					<view class="okpayfor">
						<view class="okpayfor-sub" @click="orderpay(2)">
							<image class="payfor-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/payforsub.png">
							</image>
							<view class="okpayfor-text">
								确认并支付
								{{stotalmoney}}
							</view>
						</view>
					</view>
					<view class="shopcart-xy">
						<image class="xy-img"
							src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/xyicon.png">
						</image>
						<view class="xy-befor">
							开通前请阅读
						</view>
						<view class="xy-vip">
							会员协议
						</view>

					</view>
				</swiper-item>
			</swiper>
		</view>

		<u-popup v-model="buyshow" mode="center" border-radius="20" width="600rpx" height="400rpx">
			<view class="showbox"></view>
			<view class="showtitle font-30">通用驾考</view>
			<view class="attrsetting">
				<view class="arrtku">
					<text class="font-35">购卡成功</text>
				</view>
				<view class="attrbutton">
					<button class="attrbuttonview font-30" @click="links()">查看</button>
					<button class="attrbuttonview font-30" @click="cancelshow()">取消</button>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	//接口
	import {
		taocan_api, //地址添加修改接口
		siteurl,
		wxlogin_api,
		checkpay_api,
		cartshops_api
	} from '@/api/index';

	export default {
		data() {
			return {
				lang: this.$i18n.locale,
				background: {
					backgroundColor: ''
				},
				titlecolor: '#ffffff',
				//tab标签
				list: [{
						name: this.$t('shopcarts.季卡')
					},
					{
						name: this.$t('shopcarts.永久卡')
					}
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
				buyshow: false, //购卡提示
				//普通卡
				talda: 0,
				//卡总价
				totalmoney: 0,
				normalkanum: 0, //普通卡数量
				normalsong: 0,
				//超级卡
				stalda: 0,
				stotalmoney: 0, //卡总价
				skanum: 0, //普通卡数量
				ssong: 0,
				//支付方式
				paytype: '',

				cartjson: {},
				terminalos: 'app', //是否小程序支付
				cartshoptxt: {}, //卡号促销价格合信息
			};
		},
		onLoad(options) {
			console.log("option", options)
			var that = this;
			// #ifdef MP-WEIXIN
			that.terminalos = 'miniprog';
			that.paytype = 'wxpay';
			// #endif


			// #ifdef APP-PLUS
			that.terminalos = 'app';
			that.paytype = 'wxpay';
			// #endif
			//var type = 0
			that.https({
				url: taocan_api,
				method: "POST",
				data: {
					//type:type
				},
				success: res => {
					// console.log("卡data", res);
					that.cartjson = res;
					//if(that.current == 0){
					//卡总价
					that.totalmoney = res.normal[that.talda].tjiage;
					console.log("卡data", that.totalmoney);
					that.normalkanum = res.normal[that.talda].tshuliang; //普通卡数量
					that.normalsong = res.normal[that.talda].zengsong;
					//}else{
					//stalda:0,
					that.stotalmoney = res.super[that.stalda].tjiage; //卡总价
					that.skanum = res.super[that.stalda].tshuliang; //普通卡数量
					that.ssong = res.super[that.stalda].zengsong;
					//}
					console.log("卡套餐",that.cartjson)

				},
				fail: err => {
					console.log(err);
				},
				complete: function(eeee) {
					//console.log(eeee,'com')
				}
			});

			//卡号促销
			that.https({
				url: cartshops_api,
				method: "POST",
				data: {
					//type:type
				},
				success: resy => {
					console.log(resy);
					that.cartshoptxt = resy;

				},
				fail: err => {
					console.log(err);
				},
				complete: function(eeee) {
					//console.log(eeee,'com')
				}
			});

			//that.cartjson=[{"tid":1,"tname":"","tleixing":0,"tshijian":60,"tdesc":null,"tshuliang":1,"tjiage":38.0,"zengsong":0},{"tid":2,"tname":"","tleixing":0,"tshijian":60,"tdesc":null,"tshuliang":5,"tjiage":125.0,"zengsong":0},{"tid":3,"tname":"","tleixing":0,"tshijian":60,"tdesc":null,"tshuliang":10,"tjiage":250.0,"zengsong":2},{"tid":4,"tname":"","tleixing":0,"tshijian":60,"tdesc":null,"tshuliang":50,"tjiage":1100.0,"zengsong":5},{"tid":5,"tname":"","tleixing":0,"tshijian":60,"tdesc":null,"tshuliang":100,"tjiage":1800.0,"zengsong":10},{"tid":6,"tname":"","tleixing":0,"tshijian":60,"tdesc":null,"tshuliang":200,"tjiage":3600.0,"zengsong":50}]
			//演示
			if (options.show == "true") {
				that.show = true
			}
			//演示
		},
		methods: {
			handleShow() {
				this.show = true
			},
			click(item) {
				console.log('item', item);
			},
			back() {
				uni.navigateBack({
					delta: 1
				});

			},
			links: function() {
				uni.navigateTo({
					url: '../ucenter/cart',
					success(e) {
						console.log('cheng gong');
					},
					fail(s) {
						console.log('err', s);
					},
					complete(t) {
						console.log(t);
					}
				});
			},
			cancelshow: function() {
				var that = this;
				that.show = false;
				uni.reLaunch({
					url: 'ucenter'
				})
			},
			taldaw: function(ind) {
				var that = this;
				console.log(ind);
				that.talda = ind;
				var money = that.cartjson.normal[ind].tjiage;
				var cartcount = that.cartjson.normal[ind].tshuliang;
				that.normalsong = that.cartjson.normal[ind].zengsong;
				that.normalkanum = cartcount;
				that.totalmoney = money;
				that.$forceUpdate()
				console.log("summmmm", that.totalmoney,that.normalsong,that.normalkanum);
			},
			staldaw: function(ind) {
				var that = this;
				console.log(ind);
				that.stalda = ind;
				var money = that.cartjson.super[ind].tjiage;
				var cartcount = that.cartjson.super[ind].tshuliang;
				that.ssong = that.cartjson.super[ind].zengsong;
				that.skanum = cartcount;
				that.stotalmoney = money;
			},

			orderpay(evt) {
				var that = this;
				// #ifdef MP-WEIXIN
				that.paytype = 'wxpay';
				// #endif


				if (that.paytype == '') {
					uni.showModal({
						title: that.$t('jihuo.提示'),
						content: that.$t('indexs.选择支付方式'),
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
					return false;
				}
				var cartlist = that.cartjson;
				var cartid = null;
				if (evt == 1) {
					cartid = cartlist.normal[that.talda].tid;
				} else {
					cartid = cartlist.super[that.stalda].tid;
				}


				console.log('zhifu ---- kkkkkk');
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				uni.getStorage({
					key: 'user_infos',
					success: function(res) {
						var paytype_wxpay = 'wxpay';
						var pay_lx = 'weixin';
						if (that.paytype == 'wxpay') {
							console.log('微信支付');
							paytype_wxpay = 'wxpay';
							pay_lx = 'weixin';
						}
						if (that.paytype == 'alipay') {
							console.log('支付宝支付');
							paytype_wxpay = 'alipay';
							pay_lx = 'zhifubao';
						}
						var uinfo = res.data;

						var stystems = null;
						// #ifdef APP-PLUS

						uni.getSystemInfo({
							success: function(res) {
								if (res.platform == 'ios') {
									console.log('苹果机器');
									stystems = 'iphone';
								} else {
									console.log('不是苹果机器222');
									stystems = 'android';
								}
								console.log(res.platform);
							}
						});
						// #endif

						// #ifdef MP-WEIXIN
						stystems = 'miniprog';

						// #endif
						if (cartid == null) {
							uni.showModal({
								title: that.$t('jihuo.提示'),
								content: that.$t('indexs.选择卡类型'),
								success: function(res) {
									if (res.confirm) {
										console.log('用户点击确定');
									} else if (res.cancel) {
										console.log('用户点击取消');
									}
								}
							});
							return false;
						}
						uni.request({
							url: siteurl + '/Service/pay.do', //仅为示例，并非真实接口地址。
							data: {
								unionid: uinfo.unionid,
								openid: uinfo.openid,
								system: stystems,
								zflx: pay_lx, //支付类型:weixin,zhifubao
								shplx: 2, //0,1,2 例如用户开通会员，或者会员购买了卡号卡密等
								shpid: cartid // 商品id
							},
							method: 'POST',
							header: {
								'Content-Type': 'application/json'
							},
							success: res => {
								console.log("res", JSON.stringify(res));
								console.log(siteurl, res)
								if (res.data.result_code == -1) {
									uni.showModal({
										title: '提示',
										content: res.data.result_msg,
										success: function(res) {
											try {
												uni.removeStorageSync('user_infos');
											} catch (e) {
												// error
											}
											uni.reLaunch({
												url: '../index/start'
											})
										}
									});
								}

								var order_info;
								var order_info;
								var order_miniinfo;
								var ddhnum = res.data.ddh;
								if (paytype_wxpay == 'wxpay') {
									order_miniinfo = res.data.wxbjson
									order_info = res.data.wxbjson
									//order_info=JSON.stringify(res.data.wxbjson);
								}
								if (paytype_wxpay == 'alipay') {
									order_info = res.data.zfbpaystr
								}
								let orderInfo = JSON.stringify(res.data);
								console.log(order_info);

								// #ifdef MP-WEIXIN
								var versionsss = '1.0.0';
								//that.paystatus(uinfo,stystems,versionsss,ddhnum);
								uni.requestPayment({
									timeStamp: order_miniinfo.timestamp,
									nonceStr: order_miniinfo.noncestr,
									package: 'prepay_id=' + order_miniinfo.prepayid,
									signType: 'MD5', //'HMAC-SHA256',
									paySign: order_miniinfo.paySign,
									success: function(res) {
										console.log('success:' + JSON.stringify(res));
										//更新会员状态


										setTimeout(function() {
											that.paystatus(uinfo, stystems,
												versionsss, ddhnum);
										}, 5000)



									},
									fail: function(err) {
										console.log('fail:' + JSON.stringify(err));
										uni.hideLoading();
									}
								});
								// #endif
								//#ifdef APP-PLUS
								uni.requestPayment({
									provider: paytype_wxpay,
									orderInfo: order_info, //微信、支付宝订单数据
									success: function(res) {
										console.log('支付成功！');
										console.log('success:' + JSON.stringify(res));
										//支付成功
										//更新会员状态
										var versionsss = plus.runtime.version;

										setTimeout(function() {
											that.paystatus(uinfo, stystems,
												versionsss, ddhnum);
										}, 5000)
									},
									fail: function(err) {
										console.log('fail:' + JSON.stringify(err));

										uni.hideLoading();
										//fail:{"errMsg":"requestPayment:fail"}
										// that.orders(0);
										//alert(JSON.stringify(err));
									},
									complete: function(e) {
										// this.orders(ordernum,2);
										// that.sendmsg();

									}
								});
								// #endif


							},
							complete: function(e) {

							}
						});
					},
					fail() {
						//返回登录按钮，重新微信登录
						uni.hideLoading();
					}
				});
			},
			paystatus: function(uinfo, stystems, versionsss, ddhnum) {
				var that = this;
				that.http({
					url: checkpay_api,
					method: 'POST',
					header: {
						// 'content-type': 'application/x-www-form-urlencoded'
						'content-type': 'application/json'
					},
					data: {
						ddh: ddhnum
					},
					success: resu => {
						console.log("resu=", resu);
						console.log(JSON.stringify(resu));
						if (resu.result_code == 1) {

							setTimeout(function() {
								that.paystatus(uinfo, stystems, versionsss, ddhnum);
							}, 5000)
						} else if (resu.result_code == 0) {
							that.userstatus(uinfo, stystems, versionsss);
						} else {
							uni.hideLoading();
							uni.showModal({
								title: '错误提示',
								content: '订单支付失败或无查询到订单号',
								success: function(res) {
									//that.wxloginshow = true;
									if (res.confirm) {
										that.tiaozhuan();
										console.log('用户点击确定');
									} else if (res.cancel) {
										that.tiaozhuan();
										console.log('用户点击取消');
									}
								}
							});
						}
					},
					fail: err => {
						uni.hideLoading();
						uni.showModal({
							title: '服务错误提示',
							content: '订单支付状态查询失败',
							success: function(res) {
								//that.wxloginshow = true;
								if (res.confirm) {
									that.tiaozhuan();
									console.log('用户点击确定');
								} else if (res.cancel) {
									that.tiaozhuan();
									console.log('用户点击取消');
								}
							}
						});
						console.log(err);
					}

				});

			},
			userstatus: function(uinfo, stystems, versionsss) {
				var that = this;
				console.log("更新会员状态")

				// #ifdef MP-WEIXIN
				var devid = '100010010';
				var system_info = 'miniprogram'
				// #endif
				// #ifdef APP-PLUS
				var devid = plus.device.uuid;
				var system_info = plus.device.model
				// #endif

				that.http({
					url: wxlogin_api,
					method: 'POST',
					header: {
						// 'content-type': 'application/x-www-form-urlencoded'
						'content-type': 'application/json'
					},
					data: {
						openid: uinfo.openid,
						unionid: uinfo.unionid,
						nick_name: uinfo.nick_name,
						pic_url: uinfo.pic_url,
						sex: uinfo.gender,
						gexing: null,
						devid: devid,
						system: stystems,
						system_info: system_info,
						version: versionsss,
						lastuptime: 0,
						lang: that.lang,
						apple_openid: null,
						apple_name: null,
						apple_famila: null,
						apple_email: null
					},
					success: resu => {
						console.log(resu);
						console.log(JSON.stringify(resu));

						//存储openid
						uni.setStorageSync('openid', uinfo.openid);
						var obj = JSON.parse(
							'{"openid":"' +
							uinfo.openid +
							'","unionid": "' +
							uinfo.unionid +
							'","kaishiriqi":"' +
							resu.kaishiriqi +
							'","jieshuriqi":"' +
							resu.jieshuriqi +
							'","userstatus":"' +
							resu.userstatus +
							'","jihuofangshi":"' +
							resu.jihuofangshi +
							'","nick_name":"' +
							uinfo.nick_name +
							'","pic_url":"' +
							uinfo.pic_url +
							'","uid":"' +
							resu.uid +
							'","dailijibie":"' +
							resu.dailijibie +
							'"}'
						);
						uni.setStorageSync('user_infos', obj);
						uni.hideLoading();
						//支付成功后状态修改，如果状态修改了 那就跳转到首页
						that.buyshow = true;

						//that.wxloginshow = false;
						//判断是否激活过 如果激活过，跳转到首页，如果没没有激活，继续激活
						// userstatus -- -3其他情况 -2到期 -1禁用 0-不是会员 1-普通会员 2-高级会员 3代理
						//var userstatus = res.userstatus;
						//var userstatus = -2;




					},
					fail: err => {
						console.log(err);
						uni.hideLoading();
						uni.showModal({
							title: '服务错误提示',
							content: '会员状态查询失败',
							success: function(res) {
								//that.wxloginshow = true;
								if (res.confirm) {
									that.tiaozhuan();
									console.log('用户点击确定');
								} else if (res.cancel) {
									that.tiaozhuan();
									console.log('用户点击取消');
								}
							}
						});
					}

				});
			},
			// radioChange: function(evt) {
			// 	var that = this;
			// 	console.log("evt=", evt)
			// 	console.log(evt.detail.value);
			// 	that.paytype = evt.detail.value;
			// },

			radioChange(evt) {
				console.log("evt", evt)
				this.paytype = evt

			},
			// tab栏切换
			change(index) {
				console.log("tab", index)
				this.swiperCurrent = index;
				// this.getOrderList(index);
			},
			transition({
				detail: {
					dx
				}
			}) {
				this.$refs.tabs.setDx(dx);
			},
			animationfinish({
				detail: {
					current
				}
			}) {
				this.$refs.tabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			}
		}
	};
</script>

<style scoped lang="scss">
	.popshow {
		position: relative;
		background-color: #FFFFFF;
	}

	.showbox {
		width: 750rpx;
		height: 50rpx;
	}

	.showtitle {
		width: 400rpx;
		height: 60rpx;
		line-height: 60rpx;
		margin: 0rpx auto 0 auto;
		text-align: center;
		background: linear-gradient(to right, #ec3ad8, #8f2eed);
		color: #FFFFFF;
		border-radius: 200rpx;
	}

	.attrsetting {
		width: 600rpx;
		height: 150rpx;
		position: relative;
		padding-top: 50rpx;
	}

	.arrtku {
		padding: 5rpx 10rpx;
		border-radius: 300rpx;
		max-width: 500rpx;
		text-align: center;
		height: 80rpx;
		line-height: 80rpx;
		margin: 0 auto;
	}

	.attrbutton {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		width: 600rpx;
		height: 100rpx;
		padding-top: 50rpx;
	}

	.attrbuttonview {
		width: 200rpx;
		display: inline-block;
		background-image: linear-gradient(to right, #ec3ad8, #8f2eed);
		color: #FFFFFF;
		border-radius: 300rpx;
		height: 60rpx;
		line-height: 60rpx;
	}

	.shopcart {
		.shopcart-banner {
			width: 750rpx;
			height: 360rpx;
			position: absolute;

			.banner-img {
				width: 100%;
				height: 100%;
				position: absolute;
				top: 0;
			}

			.shopcart-navbar {
				width: 100%;
				height: 50rpx;
				position: absolute;
				top: 100rpx;
				display: flex;
				align-items: baseline;

				.shopcart-navbar-img {
					width: 14rpx;
					height: 26rpx;
					margin-left: 30rpx;
				}

				.title {
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 38rpx;
					margin-left: 260rpx;
				}

			}

			.banner-img1 {
				width: 210rpx;
				height: 192rpx;
				position: absolute;
				top: 155rpx;
				left: 65rpx;
			}

			.shopcart-class {
				width: 400rpx;
				height: 100rpx;
				// background-color: pink;
				position: absolute;
				top: 180rpx;
				left: 283rpx;
				color: rgba(255, 239, 196, 1);
				font-size: 30rpx;
				font-family: PingFangSC-Semibold;
				font-weight: 600;
				line-height: 42rpx;

				.red {
					color: rgba(255, 0, 0, 1);
					margin: 0 10rpx;
				}
			}

		}
        .zhongjia{
			width: 750rpx;
			height: 102rpx;
			position: absolute;
			top: 314rpx;
			.zhongjiaimg{
				width: 750rpx;
				height: 102rpx;
			}
		}
		.shopcart-box {
			width: 750rpx;
			padding: 20rpx 30rpx;
			box-sizing: border-box;
			position: absolute;
			top: 330rpx;

			.shopcart-tabs {
				margin-left: 217rpx;
			}

			.swiper-box {
				width: 100%;
				height: 1200rpx;

				.cartview {
					width: 100%;
					display: flex;
					flex-wrap: wrap;
					justify-content: space-between;

					.cartviewr {
						width: 206rpx;
						height: 140rpx;
						border-radius: 20rpx;
						border: 1rpx solid #F5C781;
						margin-top: 36rpx;
						text-align: center;
						padding-top: 26rpx;
						position: relative;



						.cartviewrowtxt {
							font-size: 36rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: 500;
							color: #9A5838;
							line-height: 42rpx;
						}

						.cartviewrowprice {
							font-size: 26rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #A7927D;
							line-height: 30rpx;
							margin-top: 10rpx;
						}

						.song {
							width: 73rpx;
							height: 33rpx;
							font-size: 24rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #FFFFFF;
							line-height: 28rpx;
							background-image: url(/static/img/songbg.png);
							background-size: 100% 100%;
							position: absolute;
							top: -15rpx;
							right: 0;
						}
					}

					.boxbg {
						background-image: url('https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/boxbg.png');
						background-size: 100% 100%;
						border: none;
					}
				}


			}


			.activity {
				width: 100%;
				height: 150rpx;
				margin-top: 40rpx;
				display: flex;
				box-sizing: border-box;
				justify-content: space-between;

				.activitys {
					width: 321rpx;
					height: 140rpx;
					padding-top: 10rpx;
					padding-left: 20rpx;
					box-sizing: border-box;


					.activitys-top {
						font-size: 28rpx;
						font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #843D0F;
						line-height: 33rpx;
						margin-top: 30rpx;

					}

					.activitys-bottom {
						margin-top: 10rpx;
						display: flex;
						align-items: center;

						.activitys-zeng-img {
							width: 45rpx;
							height: 45rpx;
						}

						.activity-ka {
							width: 90rpx;
							height: 39rpx;
							font-size: 28rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #A7927D;
							line-height: 33rpx;
							margin: 0 10rpx;
						}

						.activity-jia {
							width: rpx;
							height: 34rpx;
							font-size: 24rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #E60000;
							line-height: 28rpx;
						}
					}

				}

				.activityone {
					background-image: url();
					background-size: 100% 100%;
				}

				.activitytwo {
					background-image: url();
					background-size: 100% 100%;
					margin-left: -20rpx;
				}

			}

			.introduce {
				width: 690rpx;
				height: 97rpx;
				background: #333333;
				border-radius: 20rpx 20rpx 20rpx 20rpx;
				opacity: 1;
				margin-top: 30rpx;
				padding: 10rpx 20rpx;
				display: flex;
				justify-content: space-between;

				.introduce-text {
					display: flex;
					align-items: center;
					margin-top: 10rpx;

					.introduce-img {
						width: 50rpx;
						height: 50rpx;
						margin-right: 30rpx;
					}

					// width: 309rpx;
					height: 53rpx;
					font-size: 38rpx;
					font-family: PingFang SC-Medium,
					PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					line-height: 45rpx;
				}

				.introduce-zs {
					width: 248rpx;
					height: 77rpx;
					background: linear-gradient(135deg, #FFF0D9 0%, #FFC37C 100%);
					border-radius: 39rpx 39rpx 39rpx 39rpx;
					opacity: 1;
					border: 1rpx solid #979797;
					font-size: 32rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #52190D;
					line-height: 77rpx;
					text-align: center;
				}
			}

			.payfor {
				width: 100%;
				margin-top: 40rpx;

				.payfor-text {
					// width: 120rpx;
					height: 42rpx;
					font-size: 30rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #2B2B2B;
					line-height: 35rpx;
				}

				.payfor-class {
					margin-top: 30rpx;
					width: 100%;
					display: flex;
					justify-content: space-between;

					.payfor-class-item {
						width: 319rpx;
						height: 73rpx;
						background-color: #F6F6F6;
						border-radius: 56rpx 56rpx 56rpx 56rpx;
						display: flex;
						align-items: center;

						.payfor-img {
							width: 48rpx;
							height: 48rpx;
							margin: 0 20rpx;
						}

						.payfor-class-text {
							font-size: 27rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #2B2B2B;
							line-height: 73rpx;
						}
					}

					.payfored {
						background-image: url('https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/zfbg.png');
						background-size: 100% 100%;
					}


				}
			}

			.okpayfor {
				margin-top: 40rpx;
				position: relative;

				.okpayfor-sub {
					.payfor-img {
						width: 690rpx;
						height: 88rpx;
					}

					.okpayfor-text {
						width: 690rpx;
						height: 88rpx;
						font-size: 32rpx;
						font-family: PingFang SC-Bold, PingFang SC;
						font-weight: bold;
						color: #FFFFFF;
						line-height: 38rpx;
						position: absolute;
						top: 23rpx;
						text-align: center;

					}

				}
			}

			.shopcart-xy {
				margin-top: 40rpx;
				display: flex;
				font-size: 22rpx;

				.xy-img {
					width: 28rpx;
					height: 28rpx;
					margin-left: 191rpx
				}

				.xy-befor {
					color: rgba(204, 204, 204, 1);
					margin-left: 15rpx
				}

				.xy-vip {
					color: rgba(13, 160, 255, 1);
				}
			}
		}

	}
</style>